home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
cstdio.arc
/
SRC.ARC
/
STRNCPY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1984-07-29
|
366b
|
21 lines
/* strncpy.c - copy exactly n characters from s2 to s1.
(C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
G. R. Mansfield. 84/06/09.
Ver 1.0-4729.
*/
char *strncpy(s1, s2, n) /* copy t to s */
char *s1, *s2;
int n;
{
char *p;
p = s1;
while (*p++ = *s2++)
if (--n == 0)
break;
while (n--)
*p++ = '\0';
return(s1);
}